package com.xiaoxiong.mami.service;

import com.xiaoxiong.mami.dao.daomain.Cart;
import com.xiaoxiong.mami.dao.mapperImpl.CartMapperImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/7/31.
 */
@Service
public class CartService implements CartMapperImpl {

    @Autowired
    CartMapperImpl cartMapperImpl;

    @Override
    public Cart queryCartByGoodsId(String goodsId, String userId) {
        return cartMapperImpl.queryCartByGoodsId(goodsId, userId);
    }

    @Override
    public List<Cart> getCartListByUserId(String userId) {
        List<Cart> list = cartMapperImpl.getCartListByUserId(userId);
        if (list == null) {
            list = new ArrayList<>();
        }
        return list;
    }

    @Override
    public int updateCartTotal(String userId, String goodsId, String total) {
        return cartMapperImpl.updateCartTotal(userId, goodsId, total);
    }

    @Override
    public int updateCartStatus( String userId,  String goodsId, String status) {
        return cartMapperImpl.updateCartStatus(userId, goodsId, status);
    }

    @Override
    public void deleteGoodsByCartsForFinish(String userId, List<String> goodsIds) {
        cartMapperImpl.deleteGoodsByCartsForFinish(userId, goodsIds);
    }

    @Override
    public int deleteByPrimaryKey(Long id) {
        return 0;
    }

    @Override
    public int insert(Cart record) {
        return 0;
    }

    @Override
    public int insertSelective(Cart record) {
        return 0;
    }

    @Override
    public Cart selectByPrimaryKey(Long id) {
        return null;
    }

    @Override
    public int updateByPrimaryKeySelective(Cart record) {
        return 0;
    }

    @Override
    public int updateByPrimaryKey(Cart record) {
        return cartMapperImpl.updateByPrimaryKey(record);
    }

    @Override
    public int insertCart(Cart cart) {
        return cartMapperImpl.insertCart(cart);
    }


}
